package org.example.controller;

import com.github.pagehelper.PageInfo;
import org.example.entity.MyNotices;
import org.example.entity.User;
import org.example.service.MyNoticesService;
import org.example.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName MyNoticesController
 * @Description TODO
 * @Author qiuye
 * @Date 2025年08月15日 11:07
 * @Version 1.0
 */
@RestController
@RequestMapping("MyNotices")
public class MyNoticesController {
    @Autowired
    private MyNoticesService myNoticesService;
    @GetMapping("page")
    public R getMyNotices(MyNotices myNotices,
                          @RequestParam(required = false, defaultValue = "1") int page,
                          @RequestParam(required = false, defaultValue = "3") int size) {
        PageInfo<MyNotices> myNotices1 = myNoticesService.getMyNotices(myNotices, page, size);
        return R.ok(myNotices1);
    }

    @GetMapping("{id}")
    public R getMyNotices(@PathVariable("id") int id) {
        List<MyNotices> myNoticeById = myNoticesService.getMyNoticeById(id);
        return R.ok(myNoticeById);
    }
}
